from rest_framework import serializers

from goods.models import SKU


class CartSKUSerializer(serializers.ModelSerializer):

    count = serializers.IntegerField(label='数量')


    class Meta:
        model = SKU
        fields = ('id','count', 'name', 'default_image_url', 'price')


class PlaceOrderSerializer(serializers.Serializer):

    freight = serializers.DecimalField(label='运费',max_digits=10,decimal_places=2)
    # CartSKUSerializer(skus,many=True)
    skus = CartSKUSerializer(many=True)